import http from '@/utils/http'

const BASE_URL = '/cakerun/feedbackInfo'

export interface FeedbackInfoResp {
  id: string
  shopId: string
  accountId: string
  feedbackId: string
  userId: string
  userName: string
  userAvatar: string
  userLevel: string
  userLevelIcon: string
  isVip: string
  content: string
  score: string
  accurateScore: string
  subScores: string
  feedbackTime: string
  likeCount: string
  viewCount: string
  replyCount: string
  isHighQuality: string
  poiName: string
  showSource1: string
  showSource2: string
  appealStatus: string
  appealStatusName: string
  hasAppeal: string
  createUser: string
  createTime: string
  updateUser: string
  updateTime: string
  businessTime: string
  createUserString: string
  updateUserString: string
  disabled: boolean
}
export interface FeedbackInfoDetailResp {
  id: string
  shopId: string
  accountId: string
  feedbackId: string
  userId: string
  userName: string
  userAvatar: string
  userLevel: string
  userLevelIcon: string
  isVip: string
  content: string
  score: string
  accurateScore: string
  subScores: string
  feedbackTime: string
  likeCount: string
  viewCount: string
  replyCount: string
  isHighQuality: string
  poiName: string
  showSource1: string
  showSource2: string
  appealStatus: string
  appealStatusName: string
  hasAppeal: string
  createUser: string
  createTime: string
  updateUser: string
  updateTime: string
  businessTime: string
  createUserString: string
  updateUserString: string
}
export interface FeedbackInfoQuery {
  sort: Array<string>
  accountId?: Array<string>
}
export interface FeedbackInfoPageQuery extends FeedbackInfoQuery, PageQuery {}

/** @desc 查询评论反馈列表 */
export function listFeedbackInfo(query: FeedbackInfoPageQuery) {
  return http.get<PageRes<FeedbackInfoResp[]>>(BASE_URL, query)
}

/** @desc 查询评论反馈详情 */
export function getFeedbackInfo(id: string) {
  return http.get<FeedbackInfoDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增评论反馈 */
export function addFeedbackInfo(data: any) {
  return http.post(BASE_URL, data)
}

/** @desc 修改评论反馈 */
export function updateFeedbackInfo(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除评论反馈 */
export function deleteFeedbackInfo(id: string) {
  return http.del(BASE_URL, { ids: [id] })
}

/** @desc 导出评论反馈 */
export function exportFeedbackInfo(query: FeedbackInfoQuery) {
  return http.download(`${BASE_URL}/export`, query)
}
